﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Citi.HeadCount.Domain.Repository
{
    public class GOCRepository : RepositoryBase<GOC>
    {
        public List<GOC> GetGOCsByReferenceDate(DateTime referenceDate)
        {
            return GetAll().Where(x => x.ReferenceDate == referenceDate).ToList();
        }

        public List<GOC> GetGOCsRuleException()
        {
            return GetAll().Where(x => x.RuleResultId == null).ToList();
        }

        public void SaveRuleResultIdException(int gocId, int ruleResultId)
        {
            var goc = GetById(gocId);
            goc.RuleResultId = ruleResultId;
            Save(goc);

            new RuleResultRepository().SetAsException(ruleResultId);
        }
    }
}
